package com.easy.threads.entity;

import java.util.StringJoiner;

/**
 * 描述: 启动线程依赖参数
 *
 * @author gwj
 * @date 2023年12月14日 9:26
 */

public class ThreadParameter implements java.io.Serializable{

    private static final long serialVersionUID = 522531156758789396L;
    /*
     * 线程数
     */
    private int threadCount;
    /*
     * 线程名称
     */
    private String threadNamePrefix;

    /*
     * 可扩容线程数
     */
    private int expansionCount;

    /*
     * 任务所属区
     */
    private Partition partition;

    /*
     * 自动扫描配置
     */
    private Auto auto;

    public Auto getAuto() {
        return auto;
    }

    public void setAuto(Auto auto) {
        this.auto = auto;
    }

    public int getThreadCount() {
        return threadCount;
    }

    public void setThreadCount(int threadCount) {
        this.threadCount = threadCount;
    }

    public String getThreadName() {
        return threadNamePrefix == null ?"thread-":threadNamePrefix+"-";
    }

    public void setThreadNamePrefix(String threadName) {
        this.threadNamePrefix = threadName;
    }

    public Partition getPartition() {
        return partition;
    }

    public void setPartition(Partition partition) {
        this.partition = partition;
    }

    public String getThreadNamePrefix() {
        return threadNamePrefix;
    }

    public int getExpansionCount() {
        return expansionCount;
    }

    public void setExpansionCount(int expansionCount) {
        this.expansionCount = expansionCount;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", ThreadParameter.class.getSimpleName() + "[", "]")
                .add("threadCount=" + threadCount)
                .add("threadNamePrefix='" + threadNamePrefix + "'")
                .add("expansionCount=" + expansionCount)
                .add("partition=" + partition)
                .add("auto=" + auto)
                .toString();
    }
}
